package batframework.log;

import java.util.logging.Level;

public class JdkLogger extends Logger
{
	private java.util.logging.Logger log;
	
	private String className;

	@Override
	public void initLogger(Class<?> clazz)
	{
		this.className = clazz.getName();
		this.log = java.util.logging.Logger.getLogger(this.className);
	}

	@Override
	public void initLogger(String name)
	{
		this.className = name;
		this.log = java.util.logging.Logger.getLogger(this.className);
	}

	@Override
	public void info(String message)
	{
		log.log(Level.INFO,message);
	}

	@Override
	public void info(String message, Throwable t)
	{
		log.log(Level.INFO, message,t);	
	}

	@Override
	public void debug(String message)
	{
		log.logp(Level.FINE, className,Thread.currentThread().getStackTrace()[1].getMethodName(), message);
	}

	@Override
	public void debug(String message, Throwable t)
	{
		log.log(Level.FINE,message,t);
		
	}

	@Override
	public void warn(String message)
	{
		log.log(Level.WARNING,message);
	}

	@Override
	public void warn(String message, Throwable t)
	{
		log.log(Level.WARNING, message,t);
	}

	@Override
	public void error(String message)
	{
		log.log(Level.SEVERE, message);
	}

	@Override
	public void error(String message, Throwable t)
	{
		log.log(Level.SEVERE,message,t);
	}

	@Override
	public void fatal(String message)
	{
		log.log(Level.SEVERE,message);
	}

	@Override
	public void fatal(String message, Throwable t)
	{
		log.log(Level.SEVERE,message,t);
	}

	@Override
	public boolean isDebugEnabled()
	{
		return log.isLoggable(Level.FINE);
	}

	@Override
	public boolean isInfoEnabled()
	{
		return log.isLoggable(Level.INFO);
	}

	@Override
	public boolean isWarnEnabled()
	{
		return log.isLoggable(Level.WARNING);
	}

	@Override
	public boolean isErrorEnabled()
	{
		return log.isLoggable(Level.SEVERE);
	}

	@Override
	public boolean isFatalEnabled()
	{
		return log.isLoggable(Level.SEVERE);
	}
	
	
	
}
